package com.bizmerce.ebms.util;

import org.apache.commons.logging.Log;

public class EbmsLog {

	public static void warn(Log log, String message, Throwable t) {
		if (log != null)
			log.warn(message, t);
	}

	public static void warn(Log log, String message) {
		if (log != null)
			log.warn(message);
	}

	public static void debug(Log log, String message, Throwable t) {
		if (log != null)
			log.debug(message, t);
	}

	public static void debug(Log log, String message) {
		if (log != null)
			log.debug(message);
	}

	public static void info(Log log, String message, Throwable t) {
		if (log != null)
			log.info(message, t);
	}

	public static void info(Log log, String message) {
		if (log != null)
			log.info(message);
	}

	public static void fatal(Log log, String message, Throwable t) {
		if (log != null)
			log.fatal(message, t);
	}

	public static void fatal(Log log, String message) {
		if (log != null)
			log.fatal(message);
	}

	public static void error(Log log, String message, Throwable t) {
		if (log != null)
			log.error(message, t);
	}

	public static void error(Log log, String message) {
		if (log != null)
			log.error(message);
	}

	public static void warn(Log log, Throwable t, Object... messages) {
		if (log != null) {
			StringBuffer buf = new StringBuffer();
			if (messages != null && messages.length > 0) {
				for (int i = 0; i < messages.length; i++) {
					buf.append(messages[i]);
				}
			}
			log.warn(buf.toString(), t);
			buf = null;
		}
	}

	public static void warn(Log log, Object... messages) {
		if (log != null) {
			StringBuffer buf = new StringBuffer();
			if (messages != null && messages.length > 0) {
				for (int i = 0; i < messages.length; i++) {
					buf.append(messages[i]);
				}
			}
			log.warn(buf.toString());
			buf = null;
		}
	}

	public static void debug(Log log, Throwable t, Object... messages) {
		if (log != null) {
			StringBuffer buf = new StringBuffer();
			if (messages != null && messages.length > 0) {
				for (int i = 0; i < messages.length; i++) {
					buf.append(messages[i]);
				}
			}
			log.debug(buf.toString(), t);
			buf = null;
		}
	}

	public static void debug(Log log, Object... messages) {
		if (log != null) {
			StringBuffer buf = new StringBuffer();
			if (messages != null && messages.length > 0) {
				for (int i = 0; i < messages.length; i++) {
					buf.append(messages[i]);
				}
			}
			log.debug(buf.toString());
			buf = null;
		}
	}

	public static void info(Log log, Throwable t, Object... messages) {
		if (log != null) {
			StringBuffer buf = new StringBuffer();
			if (messages != null && messages.length > 0) {
				for (int i = 0; i < messages.length; i++) {
					buf.append(messages[i]);
				}
			}
			log.info(buf.toString(), t);
			buf = null;
		}
	}

	public static void info(Log log, Object... messages) {
		if (log != null) {
			StringBuffer buf = new StringBuffer();
			if (messages != null && messages.length > 0) {
				for (int i = 0; i < messages.length; i++) {
					buf.append(messages[i]);
				}
			}
			log.info(buf.toString());
			buf = null;
		}
	}

	public static void fatal(Log log, Throwable t, Object... messages) {
		if (log != null) {
			StringBuffer buf = new StringBuffer();
			if (messages != null && messages.length > 0) {
				for (int i = 0; i < messages.length; i++) {
					buf.append(messages[i]);
				}
			}
			log.fatal(buf.toString(), t);
			buf = null;
		}
	}

	public static void fatal(Log log, Object... messages) {
		if (log != null) {
			StringBuffer buf = new StringBuffer();
			if (messages != null && messages.length > 0) {
				for (int i = 0; i < messages.length; i++) {
					buf.append(messages[i]);
				}
			}
			log.fatal(buf.toString());
			buf = null;
		}
	}

	public static void error(Log log, Throwable t, Object... messages) {
		if (log != null) {
			StringBuffer buf = new StringBuffer();
			if (messages != null && messages.length > 0) {
				for (int i = 0; i < messages.length; i++) {
					buf.append(messages[i]);
				}
			}
			log.error(buf.toString(), t);
			buf = null;
		}
	}

	public static void error(Log log, Object... messages) {
		if (log != null) {
			StringBuffer buf = new StringBuffer();
			if (messages != null && messages.length > 0) {
				for (int i = 0; i < messages.length; i++) {
					buf.append(messages[i]);
				}
			}
			log.error(buf.toString());
			buf = null;
		}
	}
}
